package com.catmiao.ai.controller;


import dev.langchain4j.model.chat.ChatModel;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/llm")
public class PopularController {

    @Resource
    private ChatModel chatModel;

    @GetMapping("/chat")
    public String chat(@RequestParam(value = "prompt",defaultValue = "你是谁") String prompt){
        String chatResult = chatModel.chat(prompt);


        return chatResult;
    }
}
